package com.study.springsecurity.controller;

import com.study.springsecurity.constant.CommonConstant.Role;
import com.study.springsecurity.pojo.Result;
import com.study.springsecurity.pojo.entity.RoleEntity;
import com.study.springsecurity.service.RoleInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.security.RolesAllowed;
import java.util.List;

/**
 * 查询当前登录用户的认证信息
 */
@Slf4j
@RestController
@RequestMapping("/manage")
@RolesAllowed({Role.PLAT_MANAGE_ROLE})
public class PlatManageController {

    @Autowired
    private RoleInfoService roleInfoService;

    /**
     * 查询角色列表
     *
     * @return
     */
    @GetMapping("/queryRoleInfoList")
    public Result<List<RoleEntity>> queryRoleInfoList() {
        return new Result<>(roleInfoService.list());
    }


}
